export default {
	state: {
		tabberList: [], // 默认底部导航栏
		tabberIndex: uni.getStorageSync('tabberIndex') || 0 // 默认选中图标
	},
	mutations: {
		// 给Tabber默认选中赋值
		changeTabberIndex(state, index) {
			uni.setStorageSync('tabberIndex', index)
			state.tabberIndex = index
		},
		// 给底部导航栏赋值
		changeTabberList(state, data) {
			state.tabberList = data
		}
	},
	actions: {
		getTabberIndex({
			commit
		}, value) {
			commit("changeTabberIndex", value)
		},
		// 机构端(管理员) or 单位端(管理员和员工)
		tabberAdministrators(ctx) {
			let menuList = [{
					iconPath: require('../../static/images/tabber/home.png'),
					selectedIconPath: require('../../static/images/tabber/home-select.png'),
					text: '首页',
					code: 'home',
					customIcon: false, // 如果使用自定义扩展的图标库字体，需配置此值为true
				},
				{
					iconPath: require('../../static/images/tabber/square.png'),
					selectedIconPath: require('../../static/images/tabber/square-select.png'),
					text: '广场',
					code: 'square',
					customIcon: false,
				},
				{
					iconPath: require('../../static/images/tabber/project.png'),
					selectedIconPath: require('../../static/images/tabber/project-select.png'),
					text: '项目',
					code: 'project',
					customIcon: false,
				},
				{
					iconPath: require('../../static/images/tabber/personal.png'),
					selectedIconPath: require('../../static/images/tabber/personal-select.png'),
					text: '我的',
					code: 'personal',
					customIcon: false,
				}
			]
			ctx.commit('changeTabberList', menuList)
		},
		// 机构端(员工)
		tabberStaff(ctx) {
			let menuList = [{
					iconPath: require('../../static/images/tabber/home.png'),
					selectedIconPath: require('../../static/images/tabber/home-select.png'),
					text: '首页',
					code: 'home',
					customIcon: false, // 如果使用自定义扩展的图标库字体，需配置此值为true
				},
				{
					iconPath: require('../../static/images/tabber/square.png'),
					selectedIconPath: require('../../static/images/tabber/square-select.png'),
					text: '广场',
					code: 'square',
					customIcon: false,
				},
				{
					iconPath: require('../../static/images/tabber/task.png'),
					selectedIconPath: require('../../static/images/tabber/task-select.png'),
					text: '任务',
					code: 'project',
					customIcon: false,
				},
				{
					iconPath: require('../../static/images/tabber/personal.png'),
					selectedIconPath: require('../../static/images/tabber/personal-select.png'),
					text: '我的',
					code: 'personal',
					customIcon: false,
				}
			]
			ctx.commit('changeTabberList', menuList)
		},
		// 监管端
		tabberSupervise(ctx) {
			let menuList = [{
					iconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-home.png',
					selectedIconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-home-select.png',
					text: '首页',
					code: 'home',
					customIcon: false, // 如果使用自定义扩展的图标库字体，需配置此值为true
				},
				{
					iconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-unit.png',
					selectedIconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-unit-select.png',
					text: '社会单位',
					code: 'unit',
					customIcon: false,
				},
				{
					iconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-check.png',
					selectedIconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-check-select.png',
					text: '抽查',
					code: 'check',
					customIcon: false,
				},
				{
					iconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-report.png',
					selectedIconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-report-select.png',
					text: '报告书',
					code: 'report',
					customIcon: false,
				},
				{
					iconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-personal.png',
					selectedIconPath: 'https://fire-system.oss-cn-beijing.aliyuncs.com/web/fire-technology/tabber-personal-select.png',
					text: '我的',
					code: 'personal',
					customIcon: false,
				}
			]
			ctx.commit('changeTabberList', menuList)
		}
	}
}